package algorithm;

public class Leetcode191 {
    public int hammingWeight(int n) {
        if (n == 0) {
            return 0;
        }
        int sum = 0;
        for (int i = 0; i < 32; i++) {
            sum += n & 1;
            n>>=1;
        }
        return sum;
    }
    public static void main(String[] args) {

    }
}
